package com.example.hilt_mvvm_http.app

import android.app.Application
import android.util.Log
import com.example.hilt_mvvm_http.mmkv.AuthMMKV
import com.tencent.mmkv.MMKV
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class App:Application() {

    override fun onCreate() {
        super.onCreate()
        app = this
        val str = MMKV.initialize(this)
        Log.d("MMKV", "onCreate: $str")
//        //测试
//        MMKV.defaultMMKV().encode("hasLogin",true) //写入
//        val decodeBool = MMKV.defaultMMKV().decodeBool("hasLogin") //读取
//        Log.d("MMKV", "hasLogin: $decodeBool")
//        AuthMMKV.token = "1234566" //写入数据
//        Log.d("MMKV", "读物数据: "+AuthMMKV.token)

    }

    companion object{
        private lateinit var  app: App
        fun getAppContext():App{
            return app
        }
    }
}